-
-
Notifications
You must be signed in to change notification settings - Fork 398
Fix gRPC BoardList*
methods concurrency issues
#1804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix gRPC BoardList*
methods concurrency issues
#1804
Conversation
5f9c668
to
e2ebc8c
Compare
I tried this in IDE2, and it does not work as expected. When the indexes update runs, I plug in and detach a board, I see the following panic:
|
@kittaakos thanks for the bug report! It should be fixed now, may you try this one? |
This version is way more robust than the previous one. Thank you! I still found one issue, however. I do not know the exact steps/timing, but I unplugged two connected boards when the indexes update/core client re-initialization was in progress. Please reference the attached stacktrace: click to see the stacktrace
|
IMHO this is unrelated to the discovery: I see a running And since I'm here I'm going to move the gRPC testsuite on his own PR, so we can review it, it has no sense to keep it here. |
I am positive you know this better, but the panic does not happen from IDE2 |
Actually, it happened before the patch: arduino/arduino-ide#681 (comment) |
b777797
to
b438830
Compare
I've removed the "testuite" part, this PR should be ready to review now. |
BoardList*
methods concurrency issues / Add testsuite for gRPCBoardList*
methods concurrency issues
b438830
to
fc8501c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some general testing both using the Arduino CLI gRPC interface directly, as well as with the latest build of Arduino IDE 2.x (2.0.0-rc9.1-snapshot-0b33b51). I did not manage to cause any misbehavior, but unfortunately I also was not able to reproduce the issue when using the latest build of Arduino CLI from the master
branch.
Codecov Report
@@ Coverage Diff @@
## daemon-fixes #1804 +/- ##
================================================
+ Coverage 36.34% 36.39% +0.04%
================================================
Files 232 232
Lines 19496 19401 -95
================================================
- Hits 7086 7061 -25
+ Misses 11583 11511 -72
- Partials 827 829 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. |
7b8d40b
to
d5c39ce
Compare
d5c39ce
to
52499a9
Compare
Now the DiscoveryManager is able to start the discoveries and add/remove them in a thread-safe way. Also the watchers may connect and disconnect seamlessly at any time, the incoming events from the discovery are broadcasted correctly to each active watcher. This refactoring dramatically simplifies the DiscoveryManager design.
it will be useful in the next commits.
there is already a cache in the DiscoveryManager there is no need to duplicate it.
otherwise the discovery may send some events before the eventChan is setup (and those events will be lost)
Co-authored-by: Umberto Baldi <[email protected]>
c3a13cc
to
4c197b8
Compare
Since arduino#1804 has been fixed.
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)What kind of change does this PR introduce?
Fix the functionality of the discovery manager, making it more robust when
arduino-cli
is running as a daemon with many concurrent calls.What is the current behavior?
The behavior is undefined, the most frequent issues are:
BoardListWatch
is disconnected and reconnected it will not see new eventsBoardList
multiple times on the same instance may cause issues/crashesWhat is the new behavior?
It should be more resistant to the above cases.
Does this PR introduce a breaking change, and is titled accordingly?
No breaking changes.
Other information:
This PR adds an experimental testsuite to test gRPC function calls. It's a collection of utilities/scripts, I finally found the time to put together.